import { ActivatedRoute } from '@angular/router';
/*
 * @Author: lusy lucy_202306@163.com
 * @Date: 2022-11-28 09:25:32
 * @LastEditors: lusy lucy_202306@163.com
 * @LastEditTime: 2022-11-29 15:23:48
 * @FilePath: \text\src\app\components\rent-management-information\rent-management-information.component.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Component, Injectable, OnInit } from '@angular/core';
import { House } from 'src/app/domains/house.domain';
import { ContractServiceSvr } from 'src/app/services/contractServiceSvr';

@Component({
  selector: 'app-rent-management-information',
  templateUrl: './rent-management-information.component.html',
  styleUrls: ['./rent-management-information.component.less']
})

@Injectable()
export class RentManagementInformationComponent implements OnInit {

  constructor(
    private activatedRoute: ActivatedRoute,
    private contractServiceSvr: ContractServiceSvr
  ) {}

  houseData = new House()
  token: string = JSON.parse(localStorage.getItem('Token')!)
  customerId: string = JSON.parse(localStorage.getItem('customerId')!)
  ContractUrl: string = ''

  ngOnInit(): void {
    this.activatedRoute.queryParams.subscribe(queryParams => {
      this.houseData = JSON.parse(queryParams['houseData'])
      this.ContractUrl = this.houseData.ContractUrl.split('|')[1]
      // console.log(this.houseData)
      // this.getContractUrl()
    })
  }

  async getContractUrl() {
    console.log(this.houseData.Id)
    console.log(this.token)
    console.log(this.customerId)
    try {
      let res = await this.contractServiceSvr.getContractUrl(this.token, this.houseData.Id, this.customerId)
    } catch (error) {
      console.log(error)
    }

  }

}
